package com.demoworld;

import com.demoworld.common.NameCreator;
import com.demoworld.dao.MongoDao;
import com.demoworld.entity.HelloKitty;
import org.junit.Test;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

/**
 * Created by francis on 2017/6/14.
 */
public class main {

    static public void main(String[] arhs) {

        int a = 20;
        System.out.println(a >> 2);

    }

    @Test
    public void add() throws InterruptedException {
        for (int i = 0; i <= 1000; i++) {
            HelloKitty input = new HelloKitty();
            input.setName(NameCreator.getRandomEnglishName());
            input.setAge(NameCreator.getRandomInt());
            input.setId(UUID.randomUUID().toString());
            new MongoDao().createHelloKitty(input);
            Thread.sleep(2);
        }
    }

    @Test
    public void get() {
        HelloKitty tmpResult = new MongoDao().getHelloKittyByName("francis");
        System.out.println(tmpResult.getId());
    }

    @Test
    public void delete() {
        int n = new MongoDao().deleteByName("francis");
        System.out.println(n);
    }
}
